class Solution(object):
	def maxDepth(self, root):
		"""
		:type root: TreeNode
		:rtype: int
		"""
		if(not root):
			return 0
		stack = [(1,root)]
		depth = 0
		while stack:
			cur_depth,node = stack.pop()
			if node:
				depth = max(cur_depth,depth)
				stack.append((cur_depth+1,node.left))
				stack.append((cur_depth+1,node.right))
	        return depth